﻿using System;
using System.Xml;
using Besture.Bll;
using Besture.Common;
using Besture.Common.Helper;
using Besture.Model;
using Besture.UI.Admin.Control;


namespace Besture.UI.Admin
{
    public partial class DefaultImage : BasePage
    {
        /// <summary>
        /// 
        /// </summary>

        #region 页面加载事件

        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void InitialLoad()
        {
            if (!IsPostBack)
            {
                //读取Cn下的配置文件并且修改
                XmlDocument doc = new XmlDocument();
                doc.Load(Server.MapPath("/DefaultConfiguration.xml"));
                XmlElement root = doc.DocumentElement;
                //直接寻找指定节点读取值
                XmlElement Addressee = (XmlElement)root.SelectSingleNode("Addressee");
                txtAddressee.Text = Addressee.InnerText.ToString();
                //XmlElement Sender = (XmlElement)root.SelectSingleNode("Sender");
                //txtSender.Text = Sender.InnerText.ToString();
                //XmlElement Password = (XmlElement)root.SelectSingleNode("Password");
                //txtPassword.Text = Password.InnerText.ToString();
            }
        }

        /// <summary>
        /// 回发
        /// </summary>
        protected override void PostBackLoad()
        {

        }


        #endregion

        #region 保存

        protected void btnSubmit_Click(object sender, EventArgs eventArgs)
        {
            //读取Cn下的配置文件并且修改
            XmlDocument doc = new XmlDocument();
            doc.Load(Server.MapPath("/DefaultConfiguration.xml"));
            XmlElement root = doc.DocumentElement;
            //直接寻找指定节点读取值
            //XmlElement DefaultImage = (XmlElement)root.SelectSingleNode("DefaultImage");
            XmlElement Addressee = (XmlElement)root.SelectSingleNode("Addressee");
            //XmlElement Sender = (XmlElement)root.SelectSingleNode("Sender");
            //XmlElement Password = (XmlElement)root.SelectSingleNode("Password");
            //DefaultImage.InnerText = ControlImage.ImageUrl;
            Addressee.InnerText = txtAddressee.Text.Trim();
            //Sender.InnerText = txtSender.Text.Trim();
            //Password.InnerText = txtPassword.Text.Trim();
            doc.Save(Server.MapPath("/DefaultConfiguration.xml"));
            FunHelper.Alert("保存成功",Request.Url.ToString());
        }
        #endregion

    }
}